package com.bitnpulse.dev2.jjh.engstudybook_free.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.bitnpulse.dev2.jjh.engstudybook_free.R;
import com.bitnpulse.dev2.jjh.engstudybook_free.listener.IPopUpButtonEventListener;

public class NoticeDialog extends CustomDialog implements android.view.View.OnClickListener{

	TextView mTxtTitle;
	TextView mTxtMsg;
	Button mBtnOk;
	
	private IPopUpButtonEventListener mPopUpButtonEventListener;
	
	public NoticeDialog(Context context) {
		super(context);
		setContentView(R.layout.dialog_notice);
		
		mTxtTitle = (TextView)findViewById(R.id.txtTitle);
		mTxtMsg = (TextView)findViewById(R.id.txtMsg);
		mBtnOk = (Button)findViewById(R.id.btnOk);
		mBtnOk.setOnClickListener(this);
	}
	
	public void show(String title, String message){
		mTxtTitle.setText(title);
		mTxtMsg.setText(message);
		show();
	}
	
	public void setButtonListener(IPopUpButtonEventListener listener){
		mPopUpButtonEventListener = listener;
	}
	
	@Override
	public void onClick(View v) {
		int id = v.getId();
		
		switch(id){
			case R.id.btnOk :
				if(mPopUpButtonEventListener != null){
					mPopUpButtonEventListener.buttonEvent(1);
				}
				break;
		}
		dismiss();
	}
	

}
